package com.cskaoyan.order.biz.handler;

import com.cskaoyan.order.biz.context.CreateOrderContext;
import com.cskaoyan.order.biz.context.TransHandlerContext;
import com.cskaoyan.order.mq.delay.DelayOrderCancelProducer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Description: 利用mq发送延迟取消订单消息
 **/
@Component
@Slf4j
public class SendMessageHandler extends AbstractTransHandler {



	@Autowired
	DelayOrderCancelProducer delayOrderCancelProducer;
	@Override
	public boolean isAsync() {
		return true;
	}

	@Override
	public boolean handle(TransHandlerContext context1) {
//		CreateOrderContext context=(CreateOrderContext)context1;
////		30min-16
////		2min-6
//		String orderId = context.getOrderId();
//
////		TODO
////		orderId -> send message for delay cancel!
//		boolean result = delayOrderCancelProducer.sendDelayOrderMessage(orderId);
//		if (result == true) {
//
//			return true;
//		}
		return false;


	}
}